package cn.edu.scau.cmi.wujiaxian.exercise9;

public class Example9_4 {
	

	public static void main(String[] args) {
		double sum = 0;
		double item = 0;
		boolean computable = true;
		String[] arg = {"5", "12", "25", "125", "98"};
		for (String s : arg) {
			try {
				item = Double.parseDouble(s);
				sum += item;
			} catch (NumberFormatException e) {
				System.out.println("非数字字符：" + e);
				computable = false;
			}
		}
		if (computable) {
			System.out.println("sum=" + sum);
		}
	}
	
}
